package com.rrx.service;

import com.rrx.mapper.FaultMapper;
import com.rrx.model.Fault;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by Administrator on 2018/8/13.
 */
@Service
public class FaultService  {
    @Autowired
    FaultMapper mapper;
    public List<Fault> selectFaultType() {
      return mapper.selectFaultType();
    }
    public List<Fault> selectFaultinfo(String faulttype) {
        List<Fault> faultinfo=mapper.selectFaultinfo(faulttype);
        return faultinfo;
    }

    public boolean addFault(String type, String info) {
        int i = mapper.addFault(type, info);
        if(i > 0)
            return true;
        return false;
    }

    public Fault[] getFaultByType(String type) {
        return mapper.getFaultByType(type);
    }

    public String[] getFaultType() {
        return mapper.getFaultType();
    }

    public boolean updateFault(int id, String type, String info, int state) {
        int i = mapper.updateFault(type, info, state, id);
        if(i > 0)
            return true;
        return false;
    }
}
